<html>
<head>
    <title>双预防系统</title>
    <link rel="stylesheet" href="../../../assets/bundle.element.css">
    <link rel="stylesheet" href="../../../style.css">

    <style>
        body {
            background: #F0F2F6;
        }

        .main-head {
            background: #fff;
            padding-left: 10px;
            padding-top: 10px;
            margin-bottom: 0px;
            border: solid 1px #fff;
        }

        .chart-outer {
            height: 200px;
        }

        .inputW {
            width: 150px;
        }

        .itemW {
            width: 200px;
        }

        .formLabelWidth {
            width: 100px;
        }

        input {
            BORDER-TOP-STYLE: none;
            BORDER-RIGHT-STYLE: none;
            BORDER-LEFT-STYLE: none;
            /*BORDER-BOTTOM-STYLE: solid*/
        }
    </style>
</head>
<body>
<div class="page" id="page-monitor">
    <div class="page-title">学校安全基本情况统计表</div>
    <div class="page-main">
        <el-row>
            <el-col :span="24">
                <div class="main-head">
                    <el-form :inline="true" size="small">
                        <el-form-item label="培训类型">
                            <el-select style="width: 150px;" v-model="trainingType">
                                <el-option label="所有" value=" "></el-option>
                                <el-option label="法制教育" value="1"></el-option>
                                <el-option label="交通安全教育" value="2"></el-option>
                                <el-option label="消防安全教育" value="3"></el-option>
                                <el-option label="心里健康教育" value="4"></el-option>
                                <el-option label="食品安全教育" value="5"></el-option>
                                <el-option label="用电安全教育" value="6"></el-option>
                                <el-option label="预防踩踏教育" value="7"></el-option>
                                <el-option label="防灾减灾安全教育" value="8"></el-option>
                                <el-option label="应急逃生安全教育" value="9"></el-option>
                                <el-option label="网络安全教育" value="10"></el-option>
                                <el-option label="社会教育安全教育" value="11"></el-option>
                                <el-option label="防性侵教育" value="12"></el-option>
                                <el-option label="其他安全教育" value="13"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="" prop="startTime">
                            <el-col :span="11">
                                <el-date-picker type="date" placeholder="开始时间" v-model="startTime"
                                                value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
                            </el-col>
                            <el-col class="line" :span="2">-</el-col>
                            <el-col :span="11">
                                <el-date-picker type="date" placeholder="结束时间" v-model="endTime"
                                                value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
                            </el-col>
                        </el-form-item>
                        <el-form-item>
                            <el-button type="primary" @click="search">查询</el-button>
                            <el-button type="primary" @click="addBtn">添加</el-button>
                        </el-form-item>
                    </el-form>
                </div>
                <el-table :data="tableData" height="660" :stripe="true" :border="true" size="mini" style="width: 100%">
                    <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
                    <el-table-column prop="trainingName" label="培训名称"></el-table-column>
                    <el-table-column prop="trainingAddress" label="培训地点"></el-table-column>
                    <el-table-column prop="trainingPeople" label="人数"></el-table-column>
                    <el-table-column prop="trainingTime" label="培训时间" width="110px">
                        <template slot-scope="scope" v-if="scope.row.trainingTime">
                            <el-tag size="medium">{{scope.row.trainingTime.replace("T"," ").substr(0,10)}}</el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column prop="convener" label="召集人"></el-table-column>
                    <el-table-column prop="trainingType" label="培训类型">
                        <template slot-scope="scope">
                            <template v-if="scope.row.trainingType==1">法制教育</template>
                            <template v-if="scope.row.trainingType==2">交通安全教育</template>
                            <template v-if="scope.row.trainingType==3">消防安全教育</template>
                            <template v-if="scope.row.trainingType==4">心里健康教育</template>
                            <template v-if="scope.row.trainingType==5">食品安全教育</template>
                            <template v-if="scope.row.trainingType==6">用电安全教育</template>
                            <template v-if="scope.row.trainingType==7">预防踩踏教育</template>
                            <template v-if="scope.row.trainingType==8">防灾减灾安全教育</template>
                            <template v-if="scope.row.trainingType==9">应急逃生安全教育</template>
                            <template v-if="scope.row.trainingType==10">网络安全教育</template>
                            <template v-if="scope.row.trainingType==11">社会教育安全教育</template>
                            <template v-if="scope.row.trainingType==12">防性侵教育</template>
                            <template v-if="scope.row.trainingType==13">其他安全教育</template>
                        </template>
                    </el-table-column>
                    <el-table-column prop="trainingContent" label="培训内容"></el-table-column>
                    <el-table-column prop="trainingPersonnel" label="培训人员"></el-table-column>
                    <el-table-column prop="otherPeople" label="其他人"></el-table-column>
                    <el-table-column prop="file" label="下载文件">
                        <template slot-scope="scope">
                            <el-button @click="report(scope.row.file)" round size="small" type="primary"
                                       icon="el-icon-download" circle></el-button>
                        </template>
                    </el-table-column>
                    <!--<el-table-column prop="status" label="状态">-->
                    <!--<template slot-scope="scope">-->
                    <!--<template v-if="scope.row.status==0">-->
                    <!--未批示-->
                    <!--</template>-->
                    <!--<template v-if="scope.row.status==1">-->
                    <!--已批示-->
                    <!--</template>-->
                    <!--</template>-->
                    <!--</el-table-column>-->
                    <!--<el-table-column prop="comAontent" label="上级批示"></el-table-column>-->
                    <el-table-column prop="stationName" label="操作" min-width="230px">
                        <template slot-scope="scope">
                            <el-button @click="editClick(scope.row)" round size="small" type="primary"
                                       icon="el-icon-edit" circle></el-button>
                            <!--<el-button icon="el-icon-delete" round size="small"-->
                            <!--@click="removeItem(scope.row.Id)"></el-button>-->
                            <!--<el-button @click="openCommend(scope.row)" round size="small" type="primary"-->
                            <!--icon="el-icon-search" circle></el-button>-->

                            <!--<el-button @click="addcheck(scope.row.Id)" size="small" icon="el-icon-search" circle>-->
                            <!--查看批示-->
                            <!--</el-button>-->
                            <el-button @click="removeItem(scope.row.Id)" round size="small" type="danger"
                                       icon="el-icon-delete" circle></el-button>
                            <!--<el-button @click="removeItem(scope.row.Id)" size="small"-->
                            <!--type="danger" icon="el-icon-delete" circle>-->
                            <!--删除-->
                            <!--</el-button>-->
                        </template>
                    </el-table-column>
                </el-table>
                <div class="page-footer">
                    <el-pagination background layout="prev, pager, next" :pagesize="pagesize" :total="totalCount"
                                   :current-page.sync="pageno" @current-change="onChangePage">
                    </el-pagination>
                </div>
            </el-col>
        </el-row>
        <el-dialog :title="'添加'" :visible.sync="addVisible" width="1000px">
            <el-form :model="addForm" ref="addForm" :inline="true" style="margin-left: 55px">
                <el-form-item label="培训名称" :label-width="120" prop="trainingName" :rules="[
                             {required:true,message:'培训名称!',trigger:'blur'}
                            ]">
                    <el-input v-model="addForm.trainingName" autocomplete="off" class="itemW"
                              placeholder="培训名称"></el-input>
                </el-form-item>

                <el-form-item label="培训地点" :label-width="120" prop="trainingAddress" :rules="[
                             {required:true,message:'培训地点!',trigger:'blur'}
                            ]">
                    <el-input v-model="addForm.trainingAddress" autocomplete="off" class="itemW"
                              placeholder="培训地点"></el-input>
                </el-form-item>

                <el-form-item label="人数" :label-width="120" prop="trainingPeople" :rules="[
                             {required:true,message:'人数!',trigger:'blur'}
                            ]">
                    <el-input v-model="addForm.trainingPeople" autocomplete="off" class="itemW"
                              placeholder="人数" type="number"></el-input>
                </el-form-item>


                <el-form-item label="培训时间" :label-width="120" prop="trainingTime" :rules="[
                             {required:true,message:'培训时间!',trigger:'blur'}
                            ]">
                    <el-date-picker
                            v-model="addForm.trainingTime"
                            type="date"
                            value-format="yyyy-MM-dd"
                            placeholder="培训时间" style="width: 200px">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="召集人" :label-width="120" prop="convener" :rules="[
                             {required:true,message:'召集人!',trigger:'blur'}
                            ]">
                    <el-input v-model="addForm.convener" autocomplete="off" class="itemW" placeholder="召集人"></el-input>
                </el-form-item>
                <el-form-item label="培训类型" :label-width="120" prop="trainingType" :rules="[
                             {required:true,message:'培训类型!',trigger:'blur'}
                            ]">
                    <el-select style="width: 200px;" v-model="addForm.trainingType">
                        <!--<el-option label="请选择" value=""></el-option>-->
                        <el-option label="法制教育" value="1"></el-option>
                        <el-option label="交通安全教育" value="2"></el-option>
                        <el-option label="消防安全教育" value="3"></el-option>
                        <el-option label="心里健康教育" value="4"></el-option>
                        <el-option label="食品安全教育" value="5"></el-option>
                        <el-option label="用电安全教育" value="6"></el-option>
                        <el-option label="预防踩踏教育" value="7"></el-option>
                        <el-option label="防灾减灾安全教育" value="8"></el-option>
                        <el-option label="应急逃生安全教育" value="9"></el-option>
                        <el-option label="网络安全教育" value="10"></el-option>
                        <el-option label="社会教育安全教育" value="11"></el-option>
                        <el-option label="防性侵教育" value="12"></el-option>
                        <el-option label="其他安全教育" value="13"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="培训内容" :label-width="120" prop="trainingContent" :rules="[
                             {required:true,message:'培训内容!',trigger:'blur'}
                            ]">
                    <el-input v-model="addForm.trainingContent" autocomplete="off" class="itemW"
                              placeholder="培训内容"></el-input>
                </el-form-item>
                <el-form-item label="培训人员" :label-width="120" prop="trainingPersonnel" :rules="[
                             {required:true,message:'培训人员!',trigger:'blur'}
                            ]">
                    <el-input v-model="addForm.trainingPersonnel" autocomplete="off" class="itemW"
                              placeholder="培训人员"></el-input>
                </el-form-item>
                <el-form-item label="其他人" :label-width="120" prop="otherPeople" :rules="[
                             {required:true,message:'其他人!',trigger:'blur'}
                            ]">
                    <el-input v-model="addForm.otherPeople" autocomplete="off" class="itemW"
                              placeholder="其他人"></el-input>
                </el-form-item>

                <el-form-item label="文件上传">
                    <!--iot.hzcando.com-->
                    <el-upload
                            class="upload-demo"
                            drag
                            :action="url+'/api/idm/v1/SchoolSafeTraining/Add'"
                            :headers="headers"
                            name="file"
                            :data="addForm"
                            :on-change="fileChange"
                            :on-success="onSuccess"
                            :on-error="onError"
                            :limit="1"
                            :auto-upload="false"
                            ref="add">
                        <i class="el-icon-upload"></i>
                        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
                        <div class="el-upload__tip" slot="tip">只能上传jpg/png文件</div>
                    </el-upload>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="addVisible = false">取 消</el-button>
                <el-button type="primary" @click="plan_submit('add')">确 定</el-button>
            </div>
        </el-dialog>
        <el-dialog :title="'编辑'" :visible.sync="editVisible" :show-close="false" style="display: none"
                   width="1000px">
            <el-form :model="editForm" ref="editForm" :inline="true" style="margin-left: 55px">

                <el-form-item label="培训名称" :label-width="120" prop="trainingName" :rules="[
                             {required:true,message:'培训名称!',trigger:'blur'}
                            ]">
                    <el-input v-model="editForm.trainingName" autocomplete="off" class="itemW"
                              placeholder="培训名称"></el-input>
                </el-form-item>

                <el-form-item label="培训地点" :label-width="120" prop="trainingAddress" :rules="[
                             {required:true,message:'培训地点!',trigger:'blur'}
                            ]">
                    <el-input v-model="editForm.trainingAddress" autocomplete="off" class="itemW"
                              placeholder="培训地点"></el-input>
                </el-form-item>

                <el-form-item label="人数" :label-width="120" prop="trainingPeople" :rules="[
                             {required:true,message:'人数!',trigger:'blur'}
                            ]">
                    <el-input v-model="editForm.trainingPeople" autocomplete="off" class="itemW"
                              placeholder="人数" type="number"></el-input>
                </el-form-item>


                <el-form-item label="培训时间" :label-width="120" prop="trainingTime" :rules="[
                             {required:true,message:'培训时间!',trigger:'blur'}
                            ]">
                    <el-date-picker
                            v-model="editForm.trainingTime"
                            type="date"
                            value-format="yyyy-MM-dd"
                            placeholder="培训时间" style="width: 200px">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="召集人" :label-width="120" prop="convener" :rules="[
                             {required:true,message:'召集人!',trigger:'blur'}
                            ]">
                    <el-input v-model="editForm.convener" autocomplete="off" class="itemW" placeholder="召集人"
                    ></el-input>
                </el-form-item>
                <el-form-item label="培训类型" :label-width="120" prop="trainingType" :rules="[
                             {required:true,message:'培训类型!',trigger:'blur'}
                            ]">
                    <el-select style="width: 200px;" v-model="editForm.trainingType">
                        <!--<el-option label="请选择" value=""></el-option>-->
                        <el-option label="法制教育" value="1"></el-option>
                        <el-option label="交通安全教育" value="2"></el-option>
                        <el-option label="消防安全教育" value="3"></el-option>
                        <el-option label="心里健康教育" value="4"></el-option>
                        <el-option label="食品安全教育" value="5"></el-option>
                        <el-option label="用电安全教育" value="6"></el-option>
                        <el-option label="预防踩踏教育" value="7"></el-option>
                        <el-option label="防灾减灾安全教育" value="8"></el-option>
                        <el-option label="应急逃生安全教育" value="9"></el-option>
                        <el-option label="网络安全教育" value="10"></el-option>
                        <el-option label="社会教育安全教育" value="11"></el-option>
                        <el-option label="防性侵教育" value="12"></el-option>
                        <el-option label="其他安全教育" value="13"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="培训内容" :label-width="120" prop="trainingContent" :rules="[
                             {required:true,message:'培训内容!',trigger:'blur'}
                            ]">
                    <el-input v-model="editForm.trainingContent" autocomplete="off" class="itemW"
                              placeholder="培训内容"></el-input>
                </el-form-item>
                <el-form-item label="培训人员" :label-width="120" prop="trainingPersonnel" :rules="[
                             {required:true,message:'培训人员!',trigger:'blur'}
                            ]">
                    <el-input v-model="editForm.trainingPersonnel" autocomplete="off" class="itemW"
                              placeholder="培训人员"></el-input>
                </el-form-item>
                <el-form-item label="其他人" :label-width="120" prop="otherPeople" :rules="[
                             {required:true,message:'其他人!',trigger:'blur'}
                            ]">
                    <el-input v-model="editForm.otherPeople" autocomplete="off" class="itemW"
                              placeholder="其他人"></el-input>
                </el-form-item>

                <el-form-item label="文件上传">
                    <!--iot.hzcando.com-->
                    <el-upload
                            class="upload-demo"
                            drag
                            :action="url+'/api/idm/v1/SchoolSafeTraining/Update'"
                            :headers="headers"
                            name="file"
                            :data="editForm"
                            :on-change="fileChange"
                            :on-success="onSuccess"
                            :on-error="onError"
                            :limit="1"
                            :auto-upload="false"
                            ref="edit">
                        <i class="el-icon-upload"></i>
                        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
                        <div class="el-upload__tip" slot="tip">只能上传jpg/png文件</div>
                    </el-upload>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="editVisible=false">取消</el-button>
                <el-button @click="plan_esubmit('edit')" type="primary">确定</el-button>
            </div>
        </el-dialog>
        <el-dialog title="批示" :visible.sync="commendVisible" :show-close="false" style="display: none">
            <el-form :model="commend">
                <el-form-item label="批示内容:">
                    <el-input v-model="commend.comAontent" autocomplete="off" type="textarea"></el-input>
                </el-form-item>
                <el-form-item label="批示时间:">
                    <el-date-picker
                            v-model="commend.commendTime"
                            type="date"
                            value-format="yyyy-MM-dd"
                            placeholder="批示时间" style="width: 200px">
                    </el-date-picker>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="commendVisible=false">取消</el-button>
                <el-button @click="Commend_submit()" type="primary">确定</el-button>
            </div>
        </el-dialog>
    </div>
</div>
<script type='text/javascript' src='../../../assets/bundle.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../assets/jquery-1.11.2.min.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../assets/echarts.min.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../js/common.js' charset='utf-8'></script>
<script type='text/javascript' src='../../../js/component.js' charset='utf-8'></script>
<script>
    var vuePage = new Vue({
            el: '#page-monitor',
            data: {
                url: SiteConfig.webApiset,
                headers: {
                    uid: '',
                    token: '',
                },
                commend: {},
                commendVisible: false,
                trainingType: '',
                startTime: '',
                endTime: '',
                addVisible: false,
                editVisible: false,
                tableData: [],
                pagesize: 10,
                pageno: 1,
                totalCount: 0,
                addForm: {},
                editForm: {},
                param: {},
                fileList: []
            },
            created: function () {
                // this.tableData.push({
                //         trainingName: '消防',
                //         trainingAddress: '大厅',
                //         trainingPeople: '10',
                //         trainingTime: '2020-03-13',
                //         convener: '林主任',
                //         trainingType: '0',
                //         trainingContent: '消防器材演示',
                //         trainingPersonnel: '全体',
                //         otherPeople: '全体',
                //         file: '/SchoolFile/29c56161c22140a084bcaf06d58c8bcf.xlsx'
                //     },
                //     {
                //         trainingName: '防爆',
                //         trainingAddress: '大厅',
                //         trainingPeople: '10',
                //         trainingTime: '2020-03-13',
                //         convener: '林主任',
                //         trainingType: '0',
                //         trainingContent: '防爆器材演示',
                //         trainingPersonnel: '全体',
                //         otherPeople: '全体',
                //         file: '/SchoolFile/29c56161c22140a084bcaf06d58c8bcf.xlsx'
                //     })
                this.headers = {
                    uid: SiteConfig.account.uId,
                    token: SiteConfig.account.accessToken
                }
                $('.page').show();
                this.loadData();
            },
            methods: {
                fileChange(file, fileList) {
                    this.fileList = fileList;
                },
                onSuccess(res) {
                    if (res.state == 0) {
                        this.$message({
                            message: '保存成功！',
                            type: 'success'
                        });
                        this.fileList = [];
                        this.loadData();
                        // this.$refs['add'].clearFiles();
                        this.$refs['edit'].clearFiles();
                        this.addVisible = false;
                        this.editVisible = false;
                    } else {
                        this.$message({
                            type: 'error',
                            message: '报错!' + res.errMsg
                        });
                    }

                },
                onError(err) {
                    this.$message({
                        type: 'error',
                        message: '报错!' + err.errMsg
                    });
                },
                select_status() {
                    this.$forceUpdate();
                },
                Commend_submit() {
                    if (!this.commend.comAontent) {
                        this.$message({type: 'error', message: '批示内容不能为空'})
                        return;
                    }
                    if (!this.commend.commendTime) {
                        this.$message({type: 'error', message: '批示时间不能为空'})
                        return;
                    }
                    HttpUtil.get('SchoolSafeTraining/commendSubmit', this.commend).success((r) => {
                        if (r.state == 0) {
                            vuePage.$message({
                                type: 'success',
                                message: '提交成功!'
                            });
                            this.commendVisible = false;
                            vuePage.loadData();
                        } else {
                            vuePage.$message.error('提交失败!');
                        }
                    })
                },
                openCommend: function (row) {
                    this.commend = {};
                    this.commendVisible = true;
                    this.commend = row;
                },
                editClick(row) {
                    this.editForm = Object.assign(this.editForm, row);
                    // this.editForm.isYear = row.isYear.toString();
                    // this.editForm.eduType = row.eduType.toString();
                    // this.editForm.grade = row.grade.toString();

                    this.editVisible = true;
                },
                report: function (filename) {
                    window.open(SiteConfig.webApiset + filename);
                },
                removeItem: function (id) {
                    if (!id) {
                        this.$message({
                            type: 'info',
                            message: 'id为空'
                        });
                        return;
                    }
                    this.$confirm('此操作将永久删除, 是否继续?', '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        center: true
                    }).then(() => {
                        HttpUtil.get('SchoolSafeTraining/Delete', {Id: id}).success((r) => {
                            if (r.state == 0) {
                                vuePage.$message({
                                    type: 'success',
                                    message: '删除成功!'
                                });
                                vuePage.loadData();
                            } else {
                                vuePage.$message.error('删除失败!');
                            }
                        })
                    }).catch(() => {
                        this.$message({
                            type: 'info',
                            message: '已取消删除'
                        });
                    });

                },
                plan_submit(name) {
                    if (!this.addForm.trainingName) {
                        this.$message({type: 'error', message: '培训名称不能为空'})
                        return;
                    }
                    if (!this.addForm.trainingAddress) {
                        this.$message({type: 'error', message: '培训地点不能为空'})
                        return;
                    }
                    if (!this.addForm.trainingPeople) {
                        this.$message({type: 'error', message: '人数不能为空'})
                        return;
                    }
                    if (!this.addForm.trainingTime) {
                        this.$message({type: 'error', message: '培训时间不能为空'})
                        return;
                    }
                    if (!this.addForm.convener) {
                        this.$message({type: 'error', message: '召集人不能为空'})
                        return;
                    }
                    if (!this.addForm.trainingType) {
                        this.$message({type: 'error', message: '培训类型不能为空'})
                        return;
                    }

                    if (!this.addForm.trainingContent) {
                        this.$message({type: 'error', message: '培训内容不能为空'})
                        return;
                    }
                    if (!this.addForm.trainingPersonnel) {
                        this.$message({type: 'error', message: '培训人员不能为空'})
                        return;
                    }
                    if (!this.addForm.otherPeople) {
                        this.$message({type: 'error', message: '其他人不能为空'})
                        return;
                    }
                    // if (!this.addForm.personnel) {
                    //     this.$message({type: 'error', message: '人员不能为空'})
                    //     return;
                    // }
                    // if (!this.addForm.content) {
                    //     this.$message({type: 'error', message: '内容不能为空'})
                    //     return;
                    // }
                    if (this.fileList.length == 0) {
                        this.$message({
                            type: 'info',
                            message: '必须选择文件'
                        });
                        return;
                    }
                    this.addForm.projectNo = SiteConfig.account.projectNo;
                    this.$refs[name].submit();
                    this.addVisible = false;
                    this.$message({
                        message: '添加成功！',
                        type: 'success'
                    });
                    this.loadData();
                },
                plan_esubmit(name) {

                    if (!this.editForm.trainingName) {
                        this.$message({type: 'error', message: '培训名称不能为空'})
                        return;
                    }
                    if (!this.editForm.trainingAddress) {
                        this.$message({type: 'error', message: '培训地点不能为空'})
                        return;
                    }
                    if (!this.editForm.trainingPeople) {
                        this.$message({type: 'error', message: '人数不能为空'})
                        return;
                    }
                    if (!this.editForm.trainingTime) {
                        this.$message({type: 'error', message: '培训时间不能为空'})
                        return;
                    }
                    if (!this.editForm.convener) {
                        this.$message({type: 'error', message: '召集人不能为空'})
                        return;
                    }
                    if (!this.editForm.trainingType) {
                        this.$message({type: 'error', message: '培训类型不能为空'})
                        return;
                    }

                    if (!this.editForm.trainingContent) {
                        this.$message({type: 'error', message: '培训内容不能为空'})
                        return;
                    }
                    if (!this.editForm.trainingPersonnel) {
                        this.$message({type: 'error', message: '培训人员不能为空'})
                        return;
                    }
                    if (!this.editForm.otherPeople) {
                        this.$message({type: 'error', message: '其他人不能为空'})
                        return;
                    }
                    this.editForm.projectNo = SiteConfig.account.projectNo;

                    if (this.fileList.length == 0) {
                        HttpUtil.post('SchoolSafeTraining/Update', this.editForm).success((r) => {
                            this.$message({
                                message: '修改成功！',
                                type: 'success'
                            });
                            this.fileList = [];
                            this.editVisible = false;
                            this.loadData();
                        })
                    } else {
                        this.$refs[name].submit();
                    }
                    // this.$refs[name].submit();
                    // this.editVisible = false;
                    // this.$message({
                    //     message: '修改成功！',
                    //     type: 'success'
                    // });
                    // vuePage.loadData();
                }
                ,
                onChangePage(page) {
                    this.pageno = page;
                    this.loadData();
                }
                ,
                loadData: function () {
                    var param = {};
                    if (this.trainingType)
                        param.trainingType = this.trainingType;
                    if (this.startTime)
                        param.startTime = this.startTime;
                    if (this.endTime)
                        param.endTime = this.endTime;
                    if (SiteConfig.account.projectNo)
                        param.projectNo = SiteConfig.account.projectNo;
                    param.pageno = this.pageno;
                    param.pagesize = this.pagesize;
                    HttpUtil.get('SchoolSafeTraining/List', param).success((res) => {
                        vuePage.tableData = res.data;
                        vuePage.totalCount = res.total;
                        this.$set(vuePage.tableData);
                        vuePage.$forceUpdate();
                    });
                }
                ,
                addBtn: function () {
                    this.addForm = {};
                    this.addVisible = true;
                }
                ,
                search: function () {
                    this.loadData();
                }
                ,
            },
            mounted: function () {

            }
        })
    ;
</script>
</body>
</html>
